//
//  UIWebView+Utility.m
//  DGUtilityKit
//
//  Created by Jinxiao on 12/2/13.
//  Copyright (c) 2013 debugeek. All rights reserved.
//

#import "UIWebView+Utility.h"

@implementation UIWebView (JavaScript)

- (void)disableElementSelection
{
    NSString *js = @"document.documentElement.style.webkitUserSelect='none';";
    [self stringByEvaluatingJavaScriptFromString:js];
}

- (void)disableElementCallout
{
    NSString *js = @"document.documentElement.style.webkitTouchCallout='none';";
    [self stringByEvaluatingJavaScriptFromString:js];
}

- (void)changeFontSizeWithScale:(CGFloat)scale
{
    NSString *js = [NSString stringWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust='%f%%'", scale*100];
    [self stringByEvaluatingJavaScriptFromString:js];
}

@end